package pri.black.garden.biz;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import pri.black.garden.domain.Block;
import pri.black.garden.service.IBlockService;

/**
 * gardenBiz业务层处理
 * 
 * @author black
 * @date 2025-01-21
 */
@Service
public class BlockBiz
{
    @Autowired
    private IBlockService blockService;

    public IBlockService getService(){
        return blockService;
    }

    /**
     * 新增Block
     */
    public boolean save(Block block){
        if (block.getName() == null || block.getName().isEmpty()) {
            return false;
        }
        block.setDelFlag(0);
        return blockService.save(block);//看情况提取至controller中
    }

    /**
     * 更新Block
     */
    public boolean update(Block block){
        Block byId = blockService.getById(block.getId());
        block.setPid(byId.getPid());
        return blockService.updateById(block);
    }
}
